package com.huike.service;
import com.huike.mapper.ChargeMapper;
import com.huike.pojo.Charge;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Service
public class ChargeService {
    @Autowired
    private ChargeMapper chargeMapper;

    public List<Charge> getChargeList() {
        return  chargeMapper.getChargeList();
    }

    public void deleteCharge(Integer id) {
        chargeMapper.deleteCharge(id);
    }


    public List<Charge> getChargeAll(@RequestParam String chargeName){
        if (chargeName!=null&&chargeName!=""){
            chargeName="%"+chargeName+"%";
        }else {
            chargeName="%%";
        }
        return chargeMapper.getChargeAll(chargeName);
    }
    public Charge getChargeById(Integer id) {
        return chargeMapper.getChargeById(id);
    }

    public void updateCharge(Charge charge) {
        chargeMapper.updateCharge(charge);

    }
}
